Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imp upload command #23

Merged
merged 12 commits into from
Dec 8, 2023
Merged

Imp upload command #23

merged 12 commits into from
Dec 8, 2023

Conversation

pacoyang
Copy link
Collaborator

@pacoyang pacoyang commented Dec 6, 2023

  1. Add support for selecting external EVM account
  2. Add support for prompting for the project name
  3. New spinner

Comment on lines 180 to 184
if (endpoint === 'wss://poc6.phala.network/ws') {
brickProfileFactoryContractId = '0x4a7861f257568a989a9c24db60981efb745d134a138203a219da051337428b49'
} else if (endpoint === 'wss://poc5.phala.network/ws') {
brickProfileFactoryContractId = '0x489bb4fa807bbe0f877ed46be8646867a8d16ec58add141977c4bd19b0237091'
} else if (endpoint === 'wss://api.phala.network/ws') {
brickProfileFactoryContractId = '0xb59bcc4ea352f3d878874d8f496fb093bdf362fa59d6e577c075f41cd7c84924'
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should using a separate configuration file.

Comment on lines 312 to 354
async promptEvmAccountId({
contract,
cert,
}: {
contract: BrickProfileContract,
cert: CertificateData,
}) {
try {
this.action.start('Querying your external accounts')
const { output } = await contract.query.getAllEvmAccounts(cert.address, {
cert,
})

} catch (error: any) {
ux.action.stop(chalk.red('Failed to compile.\n'))
return this.error(error)
if (output.isErr) {
throw new Error(output.asErr.toString())
}
if (output.asOk.isErr) {
throw new Error(output.asOk.asErr.toString())
}
const accounts = output.asOk.asOk.map((i) => {
const obj = i.toJSON()
return {
id: obj.id,
address: obj.address,
rpcEndpoint: obj.rpc,
}
})
this.action.stop()
const { account } = await inquirer.prompt({
name: 'account',
message: 'Please select an external account:',
type: 'list',
choices: accounts.map(account => ({
name: `${account.address}. ${chalk.dim(account.rpcEndpoint)}`,
value: account.id,
})),
})
return account
} catch (error) {
this.action.fail('Failed to query your external accounts.')
return this.error(error as Error)
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering caching.

src/commands/upload.ts Show resolved Hide resolved
Copy link
Contributor

@Leechael Leechael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Leechael Leechael merged commit ff3484f into main Dec 8, 2023
2 checks passed
@Leechael Leechael deleted the feat-select-external-account branch December 8, 2023 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants